angular.module('starter.guide.service', [])



  .factory('$$GuideService', function($rootScope, $$HttpService) {
    console.info("factory----------$$GuideService");
    return {

      // 获取导游列表
      getGuideList: function(cityname, pageNum, pageSize, serviceKinds) {
        var req = {
          pageNum: pageNum,
          pageSize: pageSize,
          serviceCity: cityname,
          serviceKinds: serviceKinds
        };
        console.log(req);
        return $$HttpService.timeget("api/options/guides", req);
      },

      // 获取关注的列表
      getAttentionList: function(cityname, pageNum, pageSize, serviceKinds) {
        var req = {
          pageNum: pageNum,
          pageSize: pageSize,
          serviceKinds: serviceKinds
          // serviceCity: cityname
        };
        return $$HttpService.timeget("api/user/attentionGuides", req);
      },

      // 获取附近的导游
      getArroundList: function(cityname, pageNum, pageSize, serviceKinds) {
        console.log($rootScope.appstate);
        var req = {
          pageNum: pageNum,
          pageSize: pageSize,
          serviceKinds: serviceKinds,
          // serviceCity: cityname,
          lng: $rootScope.appstate.geolocation.lng,
          lat: $rootScope.appstate.geolocation.lat,
        };
        console.log(req);
        return $$HttpService.timeget("api/options/arroundGuides", req);
      },

      // 获取向导个人信息
      getGuideDetail: function(guideId) {
        var req = {
          guideId: guideId,
        };
        return $$HttpService.timeget("api/options/guideInformation", req);
      },

      // 通过导游id获取导游评价
      getGuideEveluatelist: function(guideId) {
        var req = {
          id: guideId,
          pageNum: 1,
          pageSize: 1000
        };
        return $$HttpService.timeget("api/options/evaluate", req);
      },


      // 关注向导
      attention: function(guideId) {
        var req = {
          associatedId: guideId
        };
        return $$HttpService.timepost("api/friend/attention", req);
      },

      // 取消关注向导
      cancelAttention: function(guideId) {
        var req = {
          associatedId: guideId
        };
        return $$HttpService.timepost("api/friend/cancelAttention", req);
      },

    };
  });
